package net.wds.ssbus.modules.dbconfig.controller;

import java.util.Arrays;
import java.util.Map;

import net.wds.ssbus.common.utils.PageUtils;
import net.wds.ssbus.common.utils.R;
import net.wds.ssbus.modules.dbconfig.entity.TbDbModelColumnCommonlyEntity;
import net.wds.ssbus.modules.dbconfig.service.TbDbModelColumnCommonlyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * 模型字段 
 *
 * @author zl
 * @email wuk@WDSource
 * @date 2020-10-26 17:47:10
 */
@RestController
@RequestMapping("/dbconfig/tbdbmodelcolumncommonly")
public class TbDbModelColumnCommonlyController {
    @Autowired
    private TbDbModelColumnCommonlyService tbDbModelColumnCommonlyService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions(":tbdbmodelcolumncommonly:list")
    public R list(@RequestParam Map<String, Object> params){

        PageUtils page = tbDbModelColumnCommonlyService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions(":tbdbmodelcolumncommonly:info")
    public R info(@PathVariable("id") Integer id){
		TbDbModelColumnCommonlyEntity tbDbModelColumnCommonly = tbDbModelColumnCommonlyService.getById(id);

        return R.ok().put("tbDbModelColumnCommonly", tbDbModelColumnCommonly);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions(":tbdbmodelcolumncommonly:save")
    public R save(@RequestBody TbDbModelColumnCommonlyEntity tbDbModelColumnCommonly){
		tbDbModelColumnCommonlyService.save(tbDbModelColumnCommonly);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions(":tbdbmodelcolumncommonly:update")
    public R update(@RequestBody TbDbModelColumnCommonlyEntity tbDbModelColumnCommonly){
		tbDbModelColumnCommonlyService.updateById(tbDbModelColumnCommonly);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions(":tbdbmodelcolumncommonly:delete")
    public R delete(@RequestBody Integer[] ids){
		tbDbModelColumnCommonlyService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
